package com.zzhua.controller;

import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class InfoController {

    /* 只能使用第三方登录的用户, 才能访问此接口, 否则会由于参数类型不对绑定不上去而报错 */
    @GetMapping("info")
    public String info(OAuth2AuthenticationToken token) {
        System.out.println(token.getPrincipal());
        return "ok";
    }

}
